from langchain_community.tools import DuckDuckGoSearchRun
from langchain_core.pydantic_v1 import BaseModel, Field
from langchain_core.tools import BaseTool

from internal.lib import decorate


class DDGInput(BaseModel):
    query: str = Field(description="需要搜索的查询语句")


@decorate("args_schema", DDGInput)
def duckduckgo_serch(**kwargs) -> BaseTool:
    return DuckDuckGoSearchRun(
        description="一个可以基于duckduckgo的搜索工具",
        args_schema=DDGInput,
    )
